-
-
Notifications
You must be signed in to change notification settings - Fork 401
Add "Go to type" hyperlinks in the hover popup (like Rust has) #4691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hi @dschrempf
I need to check if the order they come in is deterministic when we query the locations.
Yes, I just copied the Rust one.
Yeah. For some reason the locations query does not return anything when you're on the type level. This is how |
Ad "Go to type ... not showing for symbols on the type level": Actually, it makes sense, but only somewhat. When the cursor is on
However, when the cursor is on
|
Exactly - the definitions in the hover use the same functionality underneath. I don't know if this is a bug or intended behavior. Maybe @fendor knows? |
I don't know exactly, I presume it is an artefact of HIE file structure or how GHC defines the AST and its source locations. So, probably a "bug". I don't think it is something worth investing too much time into right now (i.e., not for this PR in particular), and we should rather focus on the presentation in the hover. |
Not sure why this pipeline fails. Running |
@dnikolovv The testsuite in HLS is unfortunately quite flaky. You can likely ignore the testcase, and wait for an admin to restart the job. If the failing test case cannot be reproduced locally, then you can ignore it for now. |
pTypes :: [T.Text] | ||
pTypes | ||
| Prelude.length names == 1 = dropEnd1 $ map wrapHaskell prettyTypes | ||
| otherwise = map wrapHaskell prettyTypes | ||
pTypes :: M.Map Name Location -> [T.Text] | ||
pTypes locationsMap = | ||
case names of | ||
[_singleName] -> dropEnd1 $ prettyTypes Nothing locationsMap | ||
_ -> prettyTypes Nothing locationsMap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a bit offtopic:
- Why do we
dropEnd1
whenlength names == 1
? - Why don't we
dropEnd1
whenlength names /= 1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm tempted to remove this (actually I did but then reverted it) because it seems weird and unneeded to me as well. I tested a build without it and it seemed fine.
However, this is 4 year old code introduced by 2fef041 so I can't really comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guess for the motivation behind dropEnd1
is that the author wants to avoid showing the same type/signature in pTypes
as the one shown in prettyName. If that is the case, I think we should also do dropEnd1
when length names /= 1
(for example, names
has 1 "actual" name and an evidence name), at least in today's GHC versions.
I also need to deal with this duplication when implementing signature help. I decide to filter out the same type instead of dropEnd1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why just change it to use intelecate.
… redundant dropEnd1" This reverts commit 723d56c.
This is how it looks in Rust: